{% extends 'admin/common/base.html' %}
{% block body %}

<body class="gray-bg">
    <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="role-form">
                    <div class="select-list">
                        <ul>
                            <li>
                                动作类型：<input type="text" name="action_type" />
                            </li>
                            <li>
                                订单号：<input type="text" name="order_no" />
                            </li>
                            <li>
                                商品描述：<input type="text" name="subject" />
                            </li>
                            <li>
                                交易订单号：<input type="text" name="trade_no" />
                            </li>
                            <li>
                                <label>支付状态：</label>
                                <select name="state">
                                    <option value="">所有</option>
                                    {% for dd in get_dict_data('paylog_state')%}
                                    <option value="{{dd.value}}">{{dd.label}}</option>
                                    {% endfor %}
                                </select>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
                                    class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
                                        class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

        
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
</body>
{% endblock %}
{% block js %}
{{ super() }}
<script>
    var editFlag = "{{check_perms('cms:paylog:edit')}}";
    var removeFlag = "{{check_perms('cms:paylog:remove')}}";
    var state_datas = {{get_dict_data('paylog_state') | tojson | safe}};
    $(function () {
        var options = {
            url: "{{url_for('admin.cms.paylog.list')}}",
            createUrl: "{{url_for('admin.cms.paylog.add')}}",
            updateUrl: "{{url_for('admin.cms.paylog.edit')}}?id={id}",
            removeUrl: "{{url_for('admin.cms.paylog.remove')}}",
            exportUrl: "{{url_for('admin.cms.paylog.export')}}",
            showSearch: false,
            showRefresh: false,
            showToggle: false,
            showColumns: false,
            modalName: "支付日志",
            columns: [
            {
                checkbox: true
            },
            {
                field: 'id',
                title: 'ID',
                visible: false
            },
            {
                field: 'pay_type',
                title: '支付类型'
            },
            {
                field: 'action_type',
                title: '动作类型'
            },
            {
                field: 'order_no',
                title: '订单号'
            },
            {
                field: 'subject',
                title: '商品描述'
            },
            {
                field: 'trade_no',
                title: '交易订单号'
            },
            {
                field: 'total_fee',
                title: '支付金额'
            },
            {
                field: 'state',
                title: '支付状态',
                formatter: function(value, row, index) {
                    return $.table.selectDictLabel(state_datas, value);
                }
            },
            {
                field: 'return_code',
                title: '回调返回码'
            },
            {
                field: 'return_time',
                title: '回调时间'
            },
            {
                field: 'user.username',
                title: '会员'
            },
            // {
            //     title: '操作',
            //     align: 'center',
            //     formatter: function (value, row, index) {
            //         var actions = [];
            //         actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
            //         actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a> ');
            //         return actions.join('');
            //     }
            // }
        ]
        };
        $.table.init(options);
    });

</script>
{% endblock %}